<?php
/**
 * The default template for displaying content
 *
 * Used for both single and index/archive/search.
 *
 * @package WordPress
 * @subpackage Twenty_Twelve
 * @since Twenty Twelve 1.0
 */
 /*
$dayofweek = array(
	'Mon' =>'Thứ hai',
	'Tue' =>'Thứ ba',
	'Wed' =>'Thứ tư',
	'Thu' =>'Thứ năm',
	'Fri' =>'Thứ sáu',
	'Sat' =>'Thứ bảy',
	'Sun' =>'Chủ nhật',
);
*/
$dayofweek = array(
	'T2' =>'Thứ hai',
	'T3' =>'Thứ ba',
	'T4' =>'Thứ tư',
	'T5' =>'Thứ năm',
	'T6' =>'Thứ sáu',
	'T7' =>'Thứ bảy',
	'CN' =>'Chủ nhật',
);

$post = get_post();
if (is_single() ) { //is a single post 
?>
<article id="post-<?php echo $post->ID ?>" <?php echo post_class('single') ?>>
<header class="entry-header">
	<div class="entry-date"><?php echo $dayofweek[get_the_time("D")];?>, <?php the_date(); ?> <span class="entry-views"><?php echo the_views();?></div>
	<h1 class="entry-title"><?php echo $post->post_title; ?></h1>
</header>
<div class="entry-content">
 <?php if ( is_active_sidebar( 'detail-header' ) ) : ?>
			<div id="detail-header" class="xwidget-area">
				<?php dynamic_sidebar( 'detail-header' ); ?>
			</div>
		<?php endif; ?>
	<?php 
	//the_content();
	//$content = '(Bongdaquocte.net) - '.get_the_content();
	//apply_filters('the_content', $content);
	the_content();
	?>
	<div style="text-align: right; font-weight: bold;"><?php the_author() ?></div>
	<?php the_tags('Từ khóa: <span class="entry-tags">', '</span>, <span class="entry-tags">', '</span><br />'); ?> 
	<div id="Sociable" style="width:100%">
	 <ul style="border: 0 none;float: left; font-size: 100%; list-style-type: none; margin: 2px 0px 0px 8px;padding-left: 0px;">
	  <li class="fb_like">
	  <iframe src="//www.facebook.com/plugins/like.php?href=<?php echo get_permalink( $post->ID ); ?>&amp;width&amp;layout=button_count&amp;action=like&amp;show_faces=false&amp;share=false&amp;height=21&amp;appId=1414277618802498" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:21px;" allowTransparency="true"></iframe>
	
	  
	  </li>
	  <li><div class="fb-share-button" data-href="<?php get_permalink($post->ID) ; ?>" data-type="button_count"></div></li>
	  <li style="width:80px">
	  
	 <a href="<?php get_permalink($post->ID) ; ?>" class="twitter-share-button">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
</li>
<li>
<!-- Place this tag where you want the +1 button to render. -->
<div class="g-plusone" data-annotation="bubble" data-width="200"></div>

<!-- Place this tag after the last +1 button tag. -->
<script type="text/javascript">
  (function() {
    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
    po.src = 'https://apis.google.com/js/platform.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
  })();
</script>
</li>
</ul>
</div>
	<h3 class="entry-comment">Bình luận:</h3>
	<div class="fb-comments" data-href="<?php echo get_permalink( $post->ID ); ?>" data-numposts="5" data-colorscheme="light" data-width="468"></div>
	
</div><!-- .entry-content -->
</article>
	<?php 
} else { //not a single | a list
$img = wp_get_attachment_url( get_post_thumbnail_id($post->ID, 'thumbnail') );
if(!$img || $img =='')
$img = get_first_image($post->post_content);
?>
<article id="post-<?php echo $post->ID ?>" <?php echo post_class() ?>>
<div class="entry-thumbnail">
	<img src="<?php echo $img; ?>" alt="<?php echo $post->title; ?>">
</div>
<div class="entry">
	<header class="entry-header">
		<h1 class="entry-title">
			<a href="<?php echo get_permalink($post->ID); ?>" rel="bookmark"><?php echo $post->post_title; ?></a>
		</h1>
	</header><!-- .entry-header -->
	
	<div class="entry-content">
		<?php 
		//$first = explode('<!--more-->', strip_tags($post->post_content)); 
		//echo $first[0];
		echo get_the_excerpt();
		?>
		<?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'twentytwelve' ), 'after' => '</div>' ) ); ?>
	</div><!-- .entry-content -->
</div>
		<div class="clear"></div>
</article>
<?php } ?>
<?php /*

		<footer class="entry-meta">
			<?php twentytwelve_entry_meta(); ?>
			<?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?>
			<?php if ( is_singular() && get_the_author_meta( 'description' ) && is_multi_author() ) : // If a user has filled out their description and this is a multi-author blog, show a bio on their entries. ?>
				<div class="author-info">
					<div class="author-avatar">
						<?php
						// This filter is documented in author.php 
						$author_bio_avatar_size = apply_filters( 'twentytwelve_author_bio_avatar_size', 68 );
						echo get_avatar( get_the_author_meta( 'user_email' ), $author_bio_avatar_size );
						?>
					</div><!-- .author-avatar -->
					
					<div class="author-description">
						<h2><?php printf( __( 'About %s', 'twentytwelve' ), get_the_author() ); ?></h2>
						<p><?php the_author_meta( 'description' ); ?></p>
						<div class="author-link">
							<a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="author">
								<?php printf( __( 'View all posts by %s <span class="meta-nav">&rarr;</span>', 'twentytwelve' ), get_the_author() ); ?>
							</a>
						</div><!-- .author-link	-->
					</div><!-- .author-description -->
				</div><!-- .author-info -->
			<?php endif; ?>
		</footer><!-- .entry-meta -->
*/ ?>
	</article><!-- #post -->
